package m.fun.model;

import m.common.model.FieldMeta;
import m.common.model.MigrationModel;
import m.common.model.Model;
import m.common.model.TableMeta;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@TableMeta(name = "tf_produce_info", description = "生产信息")
public class ProduceInfo extends BuildOrderModel implements MigrationModel {
    @Override
    public List<String> migrationOidList(String storeOid) throws Exception {
        return ModelQueryList.getModelList(this.getClass(),new String[]{"oid"},null,
                        QueryCondition.eq("store.oid",storeOid))
                .stream().map(Model::getOid).collect(Collectors.toList());
    }
    @FieldMeta(name="produce_date",type= FieldType.DATE,description="生产日期")
    private Date produceDate;
    @FieldMeta(name="produce_amount",type= FieldType.DOUBLE,description="生产金额")
    private Double produceAmount;
    @FieldMeta(name = "remark",type = FieldType.STRING,length = 1000,description = "备注")
    private String remark;

    public Date getProduceDate() {
        return produceDate;
    }

    public void setProduceDate(Date produceDate) {
        this.produceDate = produceDate;
    }

    public Double getProduceAmount() {
        return produceAmount;
    }

    public void setProduceAmount(Double produceAmount) {
        this.produceAmount = produceAmount;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
